/**
 * 
 */
package com.shwread.android.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.shwread.android.qysw10000182.R;


/**
 * @project qysw_e-commerce
 * @description 加载动画
 * @author zhangnannan
 * @Time 2015年4月16日 下午3:12:53
 */
public class CommonLoadingDialog
        extends
        Dialog
{
	
	/**
	 * @param context
	 */
	private ImageView         imageView;
	private AnimationDrawable animationDrawable;
	private Context           context;
	private TextView          tvText;
	
	public CommonLoadingDialog(Context context) {
		super(context, R.style.commom_loading_dialog);
		
		this.context = context;
		creatView();
	}
	
	/**
	 * 
	 */
	private void creatView() {
		
		View view = LayoutInflater.from(context).inflate(R.layout.common_loading_dialog, null);
		imageView = (ImageView) view.findViewById(R.id.common_loading_dialog_img_iv);
		tvText = (TextView) view.findViewById(R.id.common_loading_dialog_text_tv);
		tvText.setVisibility(View.GONE);
		this.setCanceledOnTouchOutside(false);
		imageView.setBackgroundResource(R.drawable.home_progress);
		animationDrawable = (AnimationDrawable) imageView.getBackground();
		animationDrawable.start();
		setContentView(view);
	}
	
}
